<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.8"></script>
    <title>vue9v-model的修饰符</title>
  </head>
  <body>
    <div id="app">
      <input v-model.number="n1" type="text" /> +
      <input v-model.number="n2" type="text" /> = <span>{{ n1+n2 }}</span>
      <hr>
      <input type="text" v-model.trim="username">
      <button @click="getUserName">获取用户名字</button>
      <hr>
      <!-- v-model.lazy在输入中的过程不会同步  、、防抖和节流 -->
      <input type="text" v-model.lazy="username">
    </div>
    <script>
      const vm = new Vue({
        el: "#app",
        data: {
          username: "张三zhangsan",
          n1: 1,
          n2: 2,
        },
        methods: {
            getUserName(){
                //使用反引号进行填充
                console.log(`用户名是："${this.username}"`);
            }
        },
      });
    </script>
  </body>
</html>
